<template>
  <div>
    <div class="header">
      <div class="header-shoulder">
        <svg class="icon rtnBtn" aria-hidden="true" @click="returnBack">
          <use xlink:href="#icon-you1"></use>
        </svg>
      </div>
      <div class="header-center">{{ pageName }}</div>
      <div class="header-shoulder"></div>
    </div>
    <div class="page-container">
      <RouterView></RouterView>
    </div>
  </div>
</template>

<script setup>
  import { RouterView, useRoute, useRouter } from 'vue-router';
  
  const route = useRoute();
  const router = useRouter();
  const pageName = route.name;

  const returnBack = () => { router.back(); };
</script>

<style lang="scss" scoped>
  .header{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: $theme-main;
    z-index: 100;
    .header-shoulder{
      float: left;
      width: 25%;
      height: 50px;
      color: white;
      position: relative;
    }
    .header-center{
      float: left;
      width: 50%;
      height: 50px;
      color: white;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 17px;
      font-weight: 500;
    }
  }
  .page-container{
    width: 100%;
    margin-top: 50px;
  }
  .rtnBtn{
    position: absolute;
    top: 50%;
    left: 25%;
    height: 50px;
    font-size: 20px;
    transform: rotateZ(180deg) translateY(25px);
    cursor: pointer;
  }
</style>